{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7\n",
      "14\n",
      "21\n",
      "28\n",
      "42\n",
      "49\n",
      "56\n",
      "63\n",
      "77\n",
      "84\n",
      "91\n",
      "98\n"
     ]
    }
   ],
   "source": [
    "for i in range(1, 101):\n",
    "    if i%7 ==0 and i%5!=0:\n",
    "        print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "number =[]\n",
    "while True:\n",
    "    X = input('请输入一个成绩：')\n",
    "    #\n",
    "    try:\n",
    "        number.append(float(X))\n",
    "    except:\n",
    "       print('输入错误')\n",
    "       while True:\n",
    "           flag = input('是否继续输入？(Y/N)').lower()\n",
    "           if flag not in ('yes', 'no'):\n",
    "               print('YES or NO')\n",
    "           else:\n",
    "               break\n",
    "       if flag == 'no':\n",
    "           break\n",
    "print('平均成绩为：', sum(number)/len(number))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1*1=1 \n",
      "2*1=2 2*2=4 \n",
      "3*1=3 3*2=6 3*3=9 \n",
      "4*1=4 4*2=8 4*3=12 4*4=16 \n",
      "5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 \n",
      "6*1=6 6*2=12 6*3=18 6*4=24 6*5=30 6*6=36 \n",
      "7*1=7 7*2=14 7*3=21 7*4=28 7*5=35 7*6=42 7*7=49 \n",
      "8*1=8 8*2=16 8*3=24 8*4=32 8*5=40 8*6=48 8*7=56 8*8=64 \n",
      "9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81 \n"
     ]
    }
   ],
   "source": [
    "for i in range(1, 10):\n",
    "    for j in range(1, i + 1):\n",
    "        print('{0}*{1}={2}'.format(i, j, i * j), end=' ')\n",
    "    print()  # 打印空行"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
